package practice1_100;

public class DifferencePath {
    public int uniquePaths(int m, int n) {
        int[][] dpTable=new int[m][n];
        dpTable[0][0]=1;

        return dp(m-1,n-1,dpTable);
    }

    private int dp(int m, int n, int[][] dpTable) {
        //跳出递归条件
        if (m<0||n<0) return 0;
        if(dpTable[m][n]!=0) return dpTable[m][n];
        int a=dp(m-1,n,dpTable)+dp(m,n-1,dpTable);
        dpTable[m][n]=a;
        return dpTable[m][n];
    }

    public static void main(String[] args) {
        int a=new DifferencePath().uniquePaths(7,3);
        System.out.println(a);
    }
}
